import React, { createRef } from 'react';

export default class Ref extends React.Component {

  a = createRef(null);

  constructor () {
    super();
    console.log(this.a.current);
  }

  // mounted
  componentDidMount () {
    console.log(this.a.current);
  }

  // 渲染
  render () {
    // jsx语法
    return (
      <div id="a" ref={ this.a }>
        hello world
      </div>
    );
  }

}
